\(\int \csc ^2(e+f x) (a+b \sin (e+f x)) \, dx\) [154]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 26 \[ \int \csc ^2(e+f x) (a+b \sin (e+f x)) \, dx=-\frac {b \text {arctanh}(\cos (e+f x))}{f}-\frac {a \cot (e+f x)}{f} \]

[Out]

-b*arctanh(cos(f*x+e))/f-a*cot(f*x+e)/f

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.211, Rules used = {2827, 3852, 8, 3855} \[ \int \csc ^2(e+f x) (a+b \sin (e+f x)) \, dx=-\frac {a \cot (e+f x)}{f}-\frac {b \text {arctanh}(\cos (e+f x))}{f} \]

[In]

Int[Csc[e + f*x]^2*(a + b*Sin[e + f*x]),x]

[Out]

-((b*ArcTanh[Cos[e + f*x]])/f) - (a*Cot[e + f*x])/f

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2827

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[c, Int[(b*S
in[e + f*x])^m, x], x] + Dist[d/b, Int[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = a \int \csc ^2(e+f x) \, dx+b \int \csc (e+f x) \, dx \\ & = -\frac {b \text {arctanh}(\cos (e+f x))}{f}-\frac {a \text {Subst}(\int 1 \, dx,x,\cot (e+f x))}{f} \\ & = -\frac {b \text {arctanh}(\cos (e+f x))}{f}-\frac {a \cot (e+f x)}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.07 (sec) , antiderivative size = 52, normalized size of antiderivative = 2.00 \[ \int \csc ^2(e+f x) (a+b \sin (e+f x)) \, dx=-\frac {a \cot (e+f x)}{f}-\frac {b \log \left (\cos \left (\frac {e}{2}+\frac {f x}{2}\right )\right )}{f}+\frac {b \log \left (\sin \left (\frac {e}{2}+\frac {f x}{2}\right )\right )}{f} \]

[In]

Integrate[Csc[e + f*x]^2*(a + b*Sin[e + f*x]),x]

[Out]

-((a*Cot[e + f*x])/f) - (b*Log[Cos[e/2 + (f*x)/2]])/f + (b*Log[Sin[e/2 + (f*x)/2]])/f

Maple [A] (verified)

Time = 0.93 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.27

method result size
derivativedivides \(\frac {-a \cot \left (f x +e \right )+b \ln \left (-\cot \left (f x +e \right )+\csc \left (f x +e \right )\right )}{f}\) \(33\)
default \(\frac {-a \cot \left (f x +e \right )+b \ln \left (-\cot \left (f x +e \right )+\csc \left (f x +e \right )\right )}{f}\) \(33\)
parallelrisch \(\frac {2 \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right ) b -a \left (-\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+\cot \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 f}\) \(44\)
risch \(-\frac {2 i a}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )}-\frac {b \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}{f}+\frac {b \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}{f}\) \(57\)
norman \(\frac {-\frac {a}{2 f}+\frac {a \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 f}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) \left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}+\frac {b \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}\) \(68\)

[In]

int(csc(f*x+e)^2*(a+b*sin(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*(-a*cot(f*x+e)+b*ln(-cot(f*x+e)+csc(f*x+e)))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 62 vs. \(2 (26) = 52\).

Time = 0.30 (sec) , antiderivative size = 62, normalized size of antiderivative = 2.38 \[ \int \csc ^2(e+f x) (a+b \sin (e+f x)) \, dx=-\frac {b \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) \sin \left (f x + e\right ) - b \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) \sin \left (f x + e\right ) + 2 \, a \cos \left (f x + e\right )}{2 \, f \sin \left (f x + e\right )} \]

[In]

integrate(csc(f*x+e)^2*(a+b*sin(f*x+e)),x, algorithm="fricas")

[Out]

-1/2*(b*log(1/2*cos(f*x + e) + 1/2)*sin(f*x + e) - b*log(-1/2*cos(f*x + e) + 1/2)*sin(f*x + e) + 2*a*cos(f*x +
 e))/(f*sin(f*x + e))

Sympy [F]

\[ \int \csc ^2(e+f x) (a+b \sin (e+f x)) \, dx=\int \left (a + b \sin {\left (e + f x \right )}\right ) \csc ^{2}{\left (e + f x \right )}\, dx \]

[In]

integrate(csc(f*x+e)**2*(a+b*sin(f*x+e)),x)

[Out]

Integral((a + b*sin(e + f*x))*csc(e + f*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.54 \[ \int \csc ^2(e+f x) (a+b \sin (e+f x)) \, dx=-\frac {b {\left (\log \left (\cos \left (f x + e\right ) + 1\right ) - \log \left (\cos \left (f x + e\right ) - 1\right )\right )} + \frac {2 \, a}{\tan \left (f x + e\right )}}{2 \, f} \]

[In]

integrate(csc(f*x+e)^2*(a+b*sin(f*x+e)),x, algorithm="maxima")

[Out]

-1/2*(b*(log(cos(f*x + e) + 1) - log(cos(f*x + e) - 1)) + 2*a/tan(f*x + e))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 58 vs. \(2 (26) = 52\).

Time = 0.32 (sec) , antiderivative size = 58, normalized size of antiderivative = 2.23 \[ \int \csc ^2(e+f x) (a+b \sin (e+f x)) \, dx=\frac {2 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}\right ) + a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - \frac {2 \, b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + a}{\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}}{2 \, f} \]

[In]

integrate(csc(f*x+e)^2*(a+b*sin(f*x+e)),x, algorithm="giac")

[Out]

1/2*(2*b*log(abs(tan(1/2*f*x + 1/2*e))) + a*tan(1/2*f*x + 1/2*e) - (2*b*tan(1/2*f*x + 1/2*e) + a)/tan(1/2*f*x
+ 1/2*e))/f

Mupad [B] (verification not implemented)

Time = 6.27 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.08 \[ \int \csc ^2(e+f x) (a+b \sin (e+f x)) \, dx=\frac {b\,\ln \left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )}{f}-\frac {a\,\mathrm {cot}\left (e+f\,x\right )}{f} \]

[In]

int((a + b*sin(e + f*x))/sin(e + f*x)^2,x)

[Out]

(b*log(tan(e/2 + (f*x)/2)))/f - (a*cot(e + f*x))/f